package com.noocodecommit.wicket.jquery;

import org.apache.wicket.IRequestTarget;
import org.apache.wicket.Request;
import org.apache.wicket.Response;
import org.apache.wicket.Session;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.protocol.http.request.WebExternalResourceRequestTarget;
import org.apache.wicket.request.RequestParameters;
import org.apache.wicket.request.target.basic.URIRequestTargetUrlCodingStrategy;

import com.noocodecommit.wicket.jquery.ajax.AjaxPage;
import com.noocodecommit.wicket.jquery.plugin.enchant.blind.BlindPage;
import com.noocodecommit.wicket.jquery.plugin.enchant.bounce.BouncePage;
import com.noocodecommit.wicket.jquery.plugin.enchant.clip.ClipPage;
import com.noocodecommit.wicket.jquery.plugin.enchant.drop.DropPage;
import com.noocodecommit.wicket.jquery.plugin.enchant.explode.ExplodePage;
import com.noocodecommit.wicket.jquery.plugin.enchant.fold.FoldPage;
import com.noocodecommit.wicket.jquery.plugin.enchant.highlight.HighlightPage;
import com.noocodecommit.wicket.jquery.plugin.enchant.pulsate.PulsatePage;
import com.noocodecommit.wicket.jquery.plugin.enchant.scale.ScalePage;
import com.noocodecommit.wicket.jquery.plugin.enchant.shake.ShakePage;
import com.noocodecommit.wicket.jquery.plugin.enchant.slide.SlidePage;
import com.noocodecommit.wicket.jquery.plugin.enchant.transfer.TransferPage;
import com.noocodecommit.wicket.jquery.plugin.lightbox.LightboxPage;
import com.noocodecommit.wicket.jquery.plugin.poll.PollPage;
import com.noocodecommit.wicket.jquery.plugin.poll.ResultPollPage;
import com.noocodecommit.wicket.jquery.plugin.ui.accordion.AccordionPage;
import com.noocodecommit.wicket.jquery.plugin.ui.datepicker.DatePickerPage;
import com.noocodecommit.wicket.jquery.plugin.ui.dialog.DialogPage;
import com.noocodecommit.wicket.jquery.plugin.ui.draggable.DraggablePage;
import com.noocodecommit.wicket.jquery.plugin.ui.droppable.DroppablePage;
import com.noocodecommit.wicket.jquery.plugin.ui.resizable.ResizablePage;
import com.noocodecommit.wicket.jquery.plugin.ui.selectable.SelectablePage;
import com.noocodecommit.wicket.jquery.plugin.ui.slider.SliderPage;
import com.noocodecommit.wicket.jquery.plugin.ui.sortable.SortablePage;
import com.noocodecommit.wicket.jquery.plugin.ui.tabs.TabsPage;

public class JQuery4WicketApplication extends WebApplication
{

	@Override
	public Class<? extends WebPage> getHomePage()
	{
		return HomePage.class;
	}

	@Override
	protected void init()
	{
		super.init();

		mountBookmarkablePage("/ajax", AjaxPage.class);
		// mountBookmarkablePage("/scriptbuilder", ScriptBuilderPage.class);

		mountBookmarkablePage("/draggable", DraggablePage.class);
		mountBookmarkablePage("/droppable", DroppablePage.class);
		mountBookmarkablePage("/sortable", SortablePage.class);
		mountBookmarkablePage("/selectable", SelectablePage.class);
		mountBookmarkablePage("/resizable", ResizablePage.class);

		mountBookmarkablePage("/accordion", AccordionPage.class);
		mountBookmarkablePage("/slider", SliderPage.class);
		mountBookmarkablePage("/tabs", TabsPage.class);
		mountBookmarkablePage("/datepicker", DatePickerPage.class);
		mountBookmarkablePage("/dialog", DialogPage.class);

		mountBookmarkablePage("/blind", BlindPage.class);
		mountBookmarkablePage("/bounce", BouncePage.class);
		mountBookmarkablePage("/clip", ClipPage.class);
		mountBookmarkablePage("/drop", DropPage.class);
		mountBookmarkablePage("/explode", ExplodePage.class);
		mountBookmarkablePage("/fold", FoldPage.class);
		mountBookmarkablePage("/highlight", HighlightPage.class);
		mountBookmarkablePage("/pulsate", PulsatePage.class);
		mountBookmarkablePage("/scale", ScalePage.class);
		mountBookmarkablePage("/shake", ShakePage.class);
		mountBookmarkablePage("/slide", SlidePage.class);
		mountBookmarkablePage("/transfer", TransferPage.class);

		mountBookmarkablePage("/lightbox", LightboxPage.class);
		mountBookmarkablePage("/poll", PollPage.class);
		mountBookmarkablePage("/resultPoll", ResultPollPage.class);

		// mountBookmarkablePage("/tutorial1", TutorialPage1.class);
		// -- Javadoc
		mount(new URIRequestTargetUrlCodingStrategy("/docs")
		{
			@Override
			public IRequestTarget decode(RequestParameters requestParameters)
			{
				String path = "/javadoc/" + getURI(requestParameters);
				return new WebExternalResourceRequestTarget(path);
			}
		});
		// --
		getMarkupSettings().setStripWicketTags(true);
	}

	@Override
	public Session newSession(Request request, Response response)
	{
		return new JQuery4WicketSession(request);
	}

}